#include<iostream>
using namespace std;

long int M,N;
long int a1[1000001];
long int a2[1000001];

int main()
{
    while(cin>>M)
    {
        int i,j,k;
        int num=0,median,mediannum;
        for(i=0;i<M;i++)
        cin>>a1[i];
        cin>>N;
        for(j=0;j<N;j++)
        cin>>a2[j];
        mediannum=(M+N+1)/2;
        for(i=0,j=0;i<M&&j<N;)
        {
            num++;
            if(a1[i]<a2[j])
            {
                if(num==mediannum)
                {
                    median=a1[i]; break;
                }
                i++;
            }
            else
            {
                if(num==mediannum)
                {
                    median=a2[j]; break;
                }
                j++;
            }
        }
/*
        for(k=0;k<=i;k++)
        cout<<a1[k]<<" ";
        cout<<endl;
        for(k=0;k<=j;k++)
        cout<<a2[k]<<" ";
        cout<<endl;
*/
        if(num==mediannum) cout<<median<<endl;
        else
        {
            if(i==M) cout<<a2[(M+N+1)/2-M-1]<<endl;
            else cout<<a1[(M+N+1)/2-N-1]<<endl;
        }
    }
    return 0;
}
